#ifndef HAPTICELEMENT_H_INCLUDED
#define HAPTICELEMENT_H_INCLUDED

#include "ConfigElement.h"

#define HAPTIC_TAG                      "haptic-device"

#define HAPTIC_NAME_ATTRIBUTE           "name"
#define HAPTIC_STIFFNESS_ATTRIBUTE      "stiffness"
#define HAPTIC_DAMP_ATTRIBUTE           "damp"

#define HAPTIC_PARAM_TAG                "setting"
#define HAPTIC_PARAM_NAME_ATTRIB        "name"
#define HAPTIC_PARAM_VALUE_ATTRIB       "value"

namespace OpenNano
{
    typedef std::map<std::string, std::string> HapticParametersMap;

    class OPENNANO_EXPORT HapticElement : public ConfigElement
    {
        DECLARE_OBJECT_FACTORY( HapticElement );

        private:
            std::string _device_name;
            double _stiffness;
            double _damp;

            bool _everything_is_good_so_far;
            HapticParametersMap _parameters;



        protected:
            void attributeFound(TiXmlAttribute * attribute );
            void childElementFound( TiXmlElement * childElement );
            void textFound(const char * text);
            bool postConfiguration();
            void init();

        public:
            const std::string& getName() const;
            double getStiffness();
            double getDamp();

            const HapticParametersMap& getParameters() const;
            bool getParameter(const std::string& name, std::string &value);
    };
}


#endif // HAPTICELEMENT_H_INCLUDED
